In digital designs, each and every sequential element has some restrictions related to the data with respect to clock in the form of windows in which data can change or not. There is always a region around the active edge of the clock in which data is not allowed to change at the input of the sequential element. This is because, if the data changes at the input within this window, we cannot guarantee the output. If this happens, there can be one of the three possibilities:
- Current output data can be the result of current input data
- Current output data can be the result of previous input data
- The output can go metastable (as explained in metastability)
Figure 1: Figure showing setup/hold window of a sequential element |
There are certain points of difference between setup time and hold time that we need to keep in mind:
- Setup time signifies the point in time before which data needs to be stable, whereas hold time is the point of time after which the data needs to be stable
- Adherence to setup time ensures that the data launched at previous active clock edge by another flip-flop gets captured at the current clock edge. On the other hand, adherence to hold time ensures that the data launched at the current edge does not get captured on the same edge.
- Above point also means that setup time adherence ensures that the design goes to next state smoothly, whereas hold time adherence means the current state is not disturbed.
Hope this post helped you in understanding the basic difference in setup time and hold time.
Also read: